<template>
  <div class="container-page container-page-resource-create">
    <createResource @upload="getResourceList" />
    <listResourceItem :list="resourceList" @delete="getResourceList" />
  </div>
</template>

<script>
// item
import createResource from './components/create.vue';
import listResourceItem from './components/list.vue';
// api
import { listResource } from '@/api/mivawork/resource.js';

export default {
  components: { createResource, listResourceItem },
  data() {
    return {
      resourceList: []
    };
  },
  async mounted() {
    await this.getResourceList();
  },
  methods: {
    async getResourceList() {
      const res = await listResource({ size: 999 });
      this.resourceList = res.data.rows;
    }
  }
};
</script>
